SMB Filesystem Client (QNX)
SMBfsys [-d nminutes] [-i size] [-n name]
[-o] [-p priority] [-P [~]semantic] [-r nseconds]
[-R bufsize] [-S bufsize] [-u user] [-x s|h] &
- -d nminutes
- If no requests are made for a particular server after nminutes
minutes, SMBfsys will detach itself from that server to save
resources. It will automatically reattach itself the first time a
new request for the server comes in. Note that many SMB servers
will automatically detach themselves from a client if they do not
receive a request from them within a certain time period as well.
SMBfsys will automatically reattach in either case. The
default for this option is 60 minutes.
- -i size
- Set the size of the inode cache in kilobytes. Default is 1k;
if a value of 0 is specified, inode values will simply be a
hash function of the filename thus will not require a cache.
The downside of this is that multiple files will end up with
the same inode number. (See description)
- -n name
- Set the NetBIOS name of the client. Since SMBfsys uses NetBIOS over
TCP/IP to send requests, the client actually has two names - the
TCP/IP name, as given by DNS or the /etc/hosts file, and the name
used by the NetBIOS session that SMBfsys establishes with the server.
By default, SMBfsys uses the TCP/IP name, up to the first dot as
the NetBIOS name. If this option is used, SMBfsys will use name
as the NetBIOS name instead.
- -o
- When a request comes in from a QNX user ID that SMBfsys has not
seen before, it attempts to establish a new user logon with the
SMB server using the information provided by the user_smb program.
If the SMB server refuses the connection because it
says that it has too many users from this client (NT Workstation
appears to allow only one user from a particular client machine
to be logged on at one time), SMBfsys will normally return an error
condition to the requesting process. If -o is specified, SMBfsys
instead uses the logon connection of the original process to make
a request of the SMB server (this will be the user ID of the process
that originally mounted the server). That means that if QNX user ID 5
first makes a request of an SMB server and gets logged in, then
later QNX user ID 7 tries to make a request and its logon is refused,
SMBfsys will use user ID 5's connection to satisfy the request. This
may give user ID 7 different permissions than expected to the SMB
server's file system.
- -p priority
- Set the priority that SMBfsys is to run at. The default is 15.
- -P [~]semantic
- Enable (or if prefixed with ~, disable) certain aspects
of POSIX filesystem semantics. Allowed semantic names:
- delete_permission
- POSIX says permission to delete a file is given
by write permission on the parent directory. Normal
DOS semantics gives delete permission if the file
itself is writable.
- delete_open
- POSIX says you can delete a file that a process has
open. The contents remain valid until the last close.
DOS semantics says it's an error to do this (though
some servers will actually do the delete and just lose
track of the space). SMBFsys tries to fake this by just
setting a bit internally to delete the file after everybody's
closed it. This can fail if a client on a different machine
has it open. The filename also remains visible in the
directory so other processes can open it after POSIX says
it should be inaccessible.
- rename_to_existing
- POSIX says you should unlink an existing file name before
renaming a file to it. Under DOS semantics it's an error
to attempt to rename a file to a name that already exists.
The defaults in all cases are to use the standard DOS semantics.
- -r nseconds
- If SMBfsys makes a request of an SMB server and has not received
a response after nseconds seconds, it deems the server to have
gone down and reports a failure indication to the requesting process.
The default is 30 seconds.
- -R bufsize
- Specify the size of the socket receive buffer in kbytes.
- -S bufsize
- Specify the size of the socket send buffer in kbytes.
- -u user
- When a user ID comes in that SMBfsys has no user_smb mapping
information for, it attempts to read the /etc/passwd file to
obtain a user name to give to the SMB server. If SMBfsys can
not find the user ID in /etc/passwd, it will use user as the
username to be given to the SMB server. The default is guest.
- -x s|h
- Use the DOS (s)ystem or (h)idden attributes to indicate POSIX execute
permission on a file. The default is to use the system attribute.
Note that the DOS/Windows/NT DIR command does not display files with
the system or hidden attributes by default. That means that making
a file executable on the QNX side will cause it to apparently vanish
on the server side. It's still there and you can open it if you know
the name, it just doesn't show up in directory listings. To see it
under DOS/Windows/NT you'll have to either use
DIR /A or use some other
command that will show files with those attributes.
The SMB (Server Message Block) file sharing protocol is used by a number
of different servers such as Windows NT, Windows 95, Windows for Workgroups,
LanMan, and Samba. SMBfsys allows a QNX system to access remote
drives residing on such systems as an SMB client.
SMBfsys implements this protocol using NetBIOS on TCP/IP
only, not NetBEUI. Accordingly, you need TCP/IP installed on both the QNX
and remote server side. Once SMBfsys is running and a remote server has
been mounted, the server's file system appears as a sub-tree in the
local directory structure.
The /etc/services file must have the following services in it :
netbios-ns 137/udp # NetBIOS name server
netbios-dgm 138/udp # NetBIOS datagram service
netbios-ssn 139/udp # NetBIOS session service
netbios-ssn 139/tcp
Once SMBfsys is running, you must perform two more steps to mount a
remote filesystem. First, you need to tell SMBfsys your remote user name
and password. This is done with the user_smb command. Once
this is done, you can mount the remote filesystem with the SMB mount
command (mount_smb).
POSIX has the concept of a file inode, or internal node value. These
are unique numbers for each data file (two hard-linked files will share the
same inode value). For the most part file inode values are
unimportant, however certain programs do look at them. e.g.
cp uses them to determine if the source and destination
are the same file. There is no corresponding value available from
an SMB server so SMBfsys has to fake a value.
An inode counter is incremented every time someone makes a request that
returns an inode value. However, this means that the inode value for
a file would be constantly changing.
To partially alleviate this,
SMBfsys maintains a cache of recently requested files and
their returned inode value. If a request for an inode value comes in,
SMBfsys checks its cache first and if the filename is present, the
previously returned value is used. Since file names are of
variable length, the number of files in the cache will depend
on how long the names are. Once a filename has been flushed from
the cache, the next time the inode value is requested a different
number will be returned. If the inode cache size is set to zero (-i 0),
SMBfsys uses a different algorithm. In this case, it takes the
file name and performs a hash function on it. The result of the
hash function is used as the inode value. This means that the
inode value for a given file will always remain constant, but two
different files might return the same inode value if they hash
to the same number.
Run SMBfsys using default parameters:
SMBfsys &
Disconnect from a server if no requests have been made for 15 minutes and
use FOOBAR as the NetBIOS name of the client.
SMBfsys -d 15 -n FOOBAR &
- /etc/services
SMBfsys requires a socket manager.
- Dosfsys manager (DOS filesystem manager)
- Fsys manager (Filesystem manager)
- mount utility (Mount partitions and filesystems)
- mount_smb utility (Mount SMB filesystems)
- Socket manager (TCP/IP socket manager, the TCP/IP User's Guide)
- Socklet manager (TCP/IP socket manager, the TCP/IP User's Guide)
- umount utility (Unmount filesystems or partitions)
- user_smb utility (Map a QNX user to an SMB user)