Hi Bill, Yes, I think I can set the label after the ext4 fs is created. However, since we want to create the ext4 fs at runtime (after init), I¹m looking for a simple option to set the label for lost+found when the ext4 fs is created. That is, we want to avoid the extra step that set the label for lost+found dir. So, to clarify my question, is it possible to set the label for lost+found dir with make_ext4fs utility or do I have to set its label after the ext4 fs is created?
Thanks, Tai On 2/5/14, 12:35 PM, "William Roberts" <[email protected]> wrote: >IIRC that all lost and founds get labeled properly if you have a valid >file_context for them (see below). Typically the issue is the one on >/data or /cache when your doing an upgrade and not formatting /data or >/cache (which means no mkdir and no label). A restorecon will suffice >in the initscript. > >system/extras/ext4_utils$ vim make_ext4fs.c > if (needs_lost_and_found) { > /* insert a lost+found directory at the beginning of >the dentries */ > struct dentry *tmp = calloc(entries + 1, sizeof(struct >dentry)); > memset(tmp, 0, sizeof(struct dentry)); > memcpy(tmp + 1, dentries, entries * sizeof(struct >dentry)); > dentries = tmp; > > dentries[0].filename = strdup("lost+found"); > asprintf(&dentries[0].path, "%slost+found", dir_path); > dentries[0].full_path = NULL; > dentries[0].size = 0; > dentries[0].mode = S_IRWXU; > dentries[0].file_type = EXT4_FT_DIR; > dentries[0].uid = 0; > dentries[0].gid = 0; > if (sehnd) { > if (selabel_lookup(sehnd, &dentries[0].secon, >dentries[0].path, dentries[0].mode) < 0) > error("cannot lookup security context >for %s", dentries[0].path); > } > entries++; > dirs++; > } > > inode = make_directory(dir_inode, entries, dentries, dirs); > > >system/core/rootdir/init.rc: > # create the lost+found directories, so as to enforce our permissions > mkdir /cache/lost+found 0770 root root > > # create the lost+found directories, so as to enforce our permissions > mkdir /data/lost+found 0770 root root > > >On Wed, Feb 5, 2014 at 7:50 AM, Tai Nguyen (tainguye) ><[email protected]> wrote: >> make_ext4fs creates a default lost+found directory without label. The >>option >> -S and -a sets the label for the root directory only. >> And option -L doesn't seem to work for me. I looked at the code and >>didn't >> see it is used anywhere except the print statement. >> >> So, what is the recommended/common way to set the label for lost+found >>dir >> in ext4 fs? >> >> Thanks, >> Tai >> >> >> _______________________________________________ >> Seandroid-list mailing list >> [email protected] >> To unsubscribe, send email to [email protected]. >> To get help, send an email containing "help" to >> [email protected]. >> > > > >-- >Respectfully, > >William C Roberts _______________________________________________ Seandroid-list mailing list [email protected] To unsubscribe, send email to [email protected]. To get help, send an email containing "help" to [email protected].
