2003-05-10 20:05:24

by Adrian McMenamin

[permalink] [raw]
Subject: inode values in file system driver

Am I allowed to assign the value 0 to an inode in a file system driver? I seem
to be having problems with a file that is being assigned this inode value
(its a FAT based filesystem so the inode values are totally artificial).

Adrian McMenamin


2003-05-13 13:43:20

by Erik Mouw

[permalink] [raw]
Subject: Re: inode values in file system driver

On Sat, May 10, 2003 at 09:18:20PM +0100, Adrian McMenamin wrote:
> Am I allowed to assign the value 0 to an inode in a file system driver? I seem
> to be having problems with a file that is being assigned this inode value
> (its a FAT based filesystem so the inode values are totally artificial).

Yes, you are. However, glibc thinks that inode 0 is special and won't
show it.

Example: mount an NTFS filesystem with -o show_sys_files and do ls on
the mountpoint. You won't see the file $MFT, but it is there when you
copy it: cp /mountpoint/\$MFT /tmp .

Yes, this is a bug in glibc.


Erik

--
Erik Mouw
[email protected] [email protected]


Attachments:
(No filename) (655.00 B)
(No filename) (189.00 B)
Download all attachments

2003-05-13 14:20:42

by Andreas Schwab

[permalink] [raw]
Subject: Re: inode values in file system driver

Erik Mouw <[email protected]> writes:

|> On Sat, May 10, 2003 at 09:18:20PM +0100, Adrian McMenamin wrote:
|> > Am I allowed to assign the value 0 to an inode in a file system driver? I seem
|> > to be having problems with a file that is being assigned this inode value
|> > (its a FAT based filesystem so the inode values are totally artificial).
|>
|> Yes, you are. However, glibc thinks that inode 0 is special and won't
|> show it.

BS. This has nothing at all to do with glibc.

Andreas.

--
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 N?rnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."

2003-05-13 14:35:03

by Nikita Danilov

[permalink] [raw]
Subject: Re: inode values in file system driver

Andreas Schwab writes:
> Erik Mouw <[email protected]> writes:
>
> |> On Sat, May 10, 2003 at 09:18:20PM +0100, Adrian McMenamin wrote:
> |> > Am I allowed to assign the value 0 to an inode in a file system driver? I seem
> |> > to be having problems with a file that is being assigned this inode value
> |> > (its a FAT based filesystem so the inode values are totally artificial).
> |>
> |> Yes, you are. However, glibc thinks that inode 0 is special and won't
> |> show it.
>
> BS. This has nothing at all to do with glibc.

from glibc-2.2.4/sysdeps/unix/readdir.c:

/* Skip deleted files. */
} while (dp->d_ino == 0);

In other words, readdir(3) will not return dirent for inode with ino 0.

>
> Andreas.
>

Nikita.

2003-05-13 14:44:12

by Andreas Schwab

[permalink] [raw]
Subject: Re: inode values in file system driver

Nikita Danilov <[email protected]> writes:

|> Andreas Schwab writes:
|> > Erik Mouw <[email protected]> writes:
|> >
|> > |> On Sat, May 10, 2003 at 09:18:20PM +0100, Adrian McMenamin wrote:
|> > |> > Am I allowed to assign the value 0 to an inode in a file system driver? I seem
|> > |> > to be having problems with a file that is being assigned this inode value
|> > |> > (its a FAT based filesystem so the inode values are totally artificial).
|> > |>
|> > |> Yes, you are. However, glibc thinks that inode 0 is special and won't
|> > |> show it.
|> >
|> > BS. This has nothing at all to do with glibc.
|>
|> from glibc-2.2.4/sysdeps/unix/readdir.c:
|>
|> /* Skip deleted files. */
|> } while (dp->d_ino == 0);
|>
|> In other words, readdir(3) will not return dirent for inode with ino 0.

I stand corrected. I was thinking of getdirentries, which does not have
this problem. But this is traditional Unix behaviour.

Andreas.

--
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 N?rnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."

2003-05-13 18:44:23

by Adrian McMenamin

[permalink] [raw]
Subject: Re: inode values in file system driver

On Tuesday 13 May 2003 15:56, Andreas Schwab wrote:
> Nikita Danilov <[email protected]> writes:
> |> Andreas Schwab writes:
> |> > Erik Mouw <[email protected]> writes:
> |> > |> On Sat, May 10, 2003 at 09:18:20PM +0100, Adrian McMenamin wrote:
> |> > |> > Am I allowed to assign the value 0 to an inode in a file system
> |> > |> > driver? I seem to be having problems with a file that is being
> |> > |> > assigned this inode value (its a FAT based filesystem so the
> |> > |> > inode values are totally artificial).
> |> > |>
> |> > |> Yes, you are. However, glibc thinks that inode 0 is special and
> |> > |> won't show it.
> |> >
> |> > BS. This has nothing at all to do with glibc.
> |>
> |> from glibc-2.2.4/sysdeps/unix/readdir.c:
> |>
> |> /* Skip deleted files. */
> |> } while (dp->d_ino == 0);
> |>
> |> In other words, readdir(3) will not return dirent for inode with ino 0.
>
> I stand corrected. I was thinking of getdirentries, which does not have
> this problem. But this is traditional Unix behaviour.
>
> Andreas.


Thanks. At least I know why my driver is failing now.

Adrian

2003-05-14 18:18:21

by Adrian McMenamin

[permalink] [raw]
Subject: Re: inode values in file system driver

On Tuesday 13 May 2003 15:56, Andreas Schwab wrote:
> Nikita Danilov <[email protected]> writes:


> |> In other words, readdir(3) will not return dirent for inode with ino 0.
>
> I stand corrected. I was thinking of getdirentries, which does not have
> this problem. But this is traditional Unix behaviour.
>


OK. I've worked round this in my driver. It will now list the file, and does
so with inode 0 (I have not tinkered with anything outside my driver, so this
won't have any impact on any other fs). Is this A Bad Thing?

Adrian