Groups | Search | Server Info | Keyboard shortcuts | Login | Register
Groups > comp.os.linux.development.system > #373
| From | "Alex Vinokur" <alexvn@users.sourceforge.net> |
|---|---|
| Newsgroups | comp.os.linux.development.system, comp.unix.programmer |
| Subject | Re: May device identifier be changed without reboot? |
| Date | 2012-01-06 11:34 +0200 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <je6f7t$4uv$1@speranza.aioe.org> (permalink) |
| References | <1ee55345-0894-4228-a9dd-13f3620dd1c3@n6g2000vbz.googlegroups.com><87y5tmm93h.fsf@sapphire.mobileactivedefense.com><barmar-9F90CC.21241505012012@news.eternal-september.org><slrnjgd73m.1ls.grahn+nntp@frailea.sa.invalid><517950e6-e9cb-4dc2-85e6-af8c4ec6b3a7@ck5g2000vbb.googlegroups.com> <87ehvdjicl.fsf@araminta.anjou.terraraq.org.uk> |
Cross-posted to 2 groups.
"Richard Kettlewell" wrote in message
news:87ehvdjicl.fsf@araminta.anjou.terraraq.org.uk...
> Alex Vinokur <alex.vinokur@gmail.com> writes:
>> May 'st.st_dev of the same file (that wasn't removed)' be changed
>> between reboots?
>
> Yes, provided you're prepared to stretch "not removed" a bit.
>
> Suppose the file is on one of several external USB hard disks. Unmount
> and detach them all, then re-attach them in a different order. What was
> formerly /dev/sdc may now be /dev/sdd, and so on. The st_dev of the
> file will differ accordingly.
Thanks.
Does it mean the ftok() function has bug in design on Linux?
-------------------------------------------
From
http://groups.google.com/group/comp.unix.programmer/msg/9dc05598257bdbb6
CentOS glibc-2.5-65.src.rpm source code:
/* sysvipc/ftok.c */
key_t
ftok (pathname, proj_id)
const char *pathname;
int proj_id;
{
struct stat64 st;
key_t key;
if (__xstat64 (_STAT_VER, pathname, &st) < 0)
return (key_t) -1;
key = ((st.st_ino & 0xffff) | ((st.st_dev & 0xff) << 16)
| ((proj_id & 0xff) << 24));
return key;
}
------------------------------------------
==========================================
From http://linux.about.com/library/cmd/blcmdl3_ftok.htm
The resulting value is the same for all pathnames that name the same file,
when the same value of proj_id is used.
==========================================
Alex
Back to comp.os.linux.development.system | Previous | Next — Previous in thread | Next in thread | Find similar
[Linux] May device identifier be changed without reboot? Alex Vinokur <alex.vinokur@gmail.com> - 2012-01-04 20:53 -0800
Re: [Linux] May device identifier be changed without reboot? Rainer Weikusat <rweikusat@mssgmbh.com> - 2012-01-05 16:01 +0000
Re: [Linux] May device identifier be changed without reboot? Barry Margolin <barmar@alum.mit.edu> - 2012-01-05 21:24 -0500
Re: [Linux] May device identifier be changed without reboot? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-01-06 07:02 +0000
Re: [Linux] May device identifier be changed without reboot? "Alex Vinokur" <alexvn@users.sourceforge.net> - 2012-01-06 10:21 +0200
Re: May device identifier be changed without reboot? Alex Vinokur <alex.vinokur@gmail.com> - 2012-01-06 00:14 -0800
Re: May device identifier be changed without reboot? Richard Kettlewell <rjk@greenend.org.uk> - 2012-01-06 09:22 +0000
Re: May device identifier be changed without reboot? "Alex Vinokur" <alexvn@users.sourceforge.net> - 2012-01-06 11:34 +0200
Re: May device identifier be changed without reboot? Barry Margolin <barmar@alum.mit.edu> - 2012-01-06 07:57 -0500
Re: May device identifier be changed without reboot? Kaz Kylheku <kaz@kylheku.com> - 2012-01-06 16:06 +0000
Re: May device identifier be changed without reboot? Alex Vinokur <alex.vinokur@gmail.com> - 2012-01-06 10:17 -0800
Re: [Linux] May device identifier be changed without reboot? Tim Roberts <timr@probo.com> - 2012-01-05 22:43 -0800
csiph-web