Questions about SFN and LFN mapping in NTFS.

Hi,

I had a few questions about name mangling in NTFS that I was hoping
someone would be able to answer:

  1. When you create a file with a long filename (LFN), NTFS maintains a
    mapping to the SFN. Is the LFN <–> SFN mapping supposed to be static?
    Or does it change dynamically i.e. Once I create a File with LFN would
    it always have the same SFN ?

  2. I am able to do this:
    Create a file with the Name: AVerrrylongfilename.txt
    When I do a dir /X I see that this file has a SFN = AVERRR~1.TXT
    Now Using explorer I try to rename another file in that directory to
    AVERRR~1.TXT. Suprisingly this succeeds and now if I do a dir /X I see
    that the SFN for AVerrrylongfilename.txt has changed to AVERRR~2.TXT
    This seems strange to me ! Is this the correct behaviour ?

  3. Is there any article/paper that talks about SFN <–> LFN in a detail?
    All I’ve been able to find are some articles on Microsoft website, but
    they don’t have any details.

Thanks for help,
-Manish


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

  1. Yes, static assuming no name changes to the file. Operations on other
    files will not affect it.
  2. Explorer is very … “smart”. It wishes to hide the fact that the
    short names exist to the best of its abilities. If you watched what is
    going on at the kernel level, you would see Explorer move the original
    file to a temporary name, do the rename for the new file, and then
    rename the original file holding down AVERR~1.TXT back to its original
    long name, which would then cause a new short name to be generated for
    it.
  3. Not to my knowledge. There isn’t a whole lot to talk about; if you
    have any questions, ask away.

-----Original Message-----
From: Manish Agarwal [mailto:magarwal@cs.umn.edu]
Sent: Friday, September 14, 2001 11:06 AM
To: File Systems Developers
Subject: [ntfsd] Questions about SFN and LFN mapping in NTFS.

Hi,

I had a few questions about name mangling in NTFS that I was hoping
someone would be able to answer:

  1. When you create a file with a long filename (LFN), NTFS maintains a
    mapping to the SFN. Is the LFN <–> SFN mapping supposed to be
    static?
    Or does it change dynamically i.e. Once I create a File with LFN
    would
    it always have the same SFN ?

  2. I am able to do this:
    Create a file with the Name: AVerrrylongfilename.txt
    When I do a dir /X I see that this file has a SFN = AVERRR~1.TXT
    Now Using explorer I try to rename another file in that directory to
    AVERRR~1.TXT. Suprisingly this succeeds and now if I do a dir /X I
    see
    that the SFN for AVerrrylongfilename.txt has changed to AVERRR~2.TXT
    This seems strange to me ! Is this the correct behaviour ?

  3. Is there any article/paper that talks about SFN <–> LFN in a detail?
    All I’ve been able to find are some articles on Microsoft website,
    but
    they don’t have any details.

Thanks for help,
-Manish


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

> I had a few questions about name mangling in NTFS that I was hoping

someone would be able to answer:

  1. When you create a file with a long filename (LFN), NTFS maintains a
    mapping to the SFN. Is the LFN <–> SFN mapping supposed to be static?
    Or does it change dynamically i.e. Once I create a File with LFN would
    it always have the same SFN ?

This is my understanding. The SFN is generated when the file is created,
renamed, or moved. It doesn’t change otherwise. And has you are seeing in
(2) below, the SFN is not unique for a particular LFN–it depends on what
files might already be in the directory when the file is assigned its SFN.

  1. I am able to do this:
    Create a file with the Name: AVerrrylongfilename.txt
    When I do a dir /X I see that this file has a SFN = AVERRR~1.TXT
    Now Using explorer I try to rename another file in that directory to
    AVERRR~1.TXT. Suprisingly this succeeds and now if I do a dir /X I see
    that the SFN for AVerrrylongfilename.txt has changed to AVERRR~2.TXT
    This seems strange to me ! Is this the correct behaviour ?

This is the behavior, bit it would be too judgemental to say it is “correct”
or not.

  1. Is there any article/paper that talks about SFN <–> LFN in a detail?
    All I’ve been able to find are some articles on Microsoft website, but
    they don’t have any details.

Don’t know.

Thanks for help,
-Manish


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

IIRC the published in IFS kit FASTFAT code has all LFN logic in place.
I do not think NTFS will differ from FASTFAT in these terms.

Max

----- Original Message -----
From: “Manish Agarwal”
To: “File Systems Developers”
Sent: Friday, September 14, 2001 10:06 PM
Subject: [ntfsd] Questions about SFN and LFN mapping in NTFS.

> Hi,
>
> I had a few questions about name mangling in NTFS that I was hoping
> someone would be able to answer:
>
> 1. When you create a file with a long filename (LFN), NTFS maintains a
> mapping to the SFN. Is the LFN <–> SFN mapping supposed to be static?
> Or does it change dynamically i.e. Once I create a File with LFN would
> it always have the same SFN ?
>
> 2. I am able to do this:
> Create a file with the Name: AVerrrylongfilename.txt
> When I do a dir /X I see that this file has a SFN = AVERRR~1.TXT
> Now Using explorer I try to rename another file in that directory to
> AVERRR~1.TXT. Suprisingly this succeeds and now if I do a dir /X I see
> that the SFN for AVerrrylongfilename.txt has changed to AVERRR~2.TXT
> This seems strange to me ! Is this the correct behaviour ?
>
> 3. Is there any article/paper that talks about SFN <–> LFN in a detail?
> All I’ve been able to find are some articles on Microsoft website, but
> they don’t have any details.
>
> Thanks for help,
> -Manish
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com