SMBfsys

SMB Filesystem Manager (QNX)

Syntax:

SMBfsys [-d nminutes] [-i size] [-n name]
        [-o] [-p priority] [-r nseconds] [-u user]
        [-x s|h] &

Options:

-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 with in 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 be simply 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 userid 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 userid of the process that originally mounted the server). That means that if QNX userid 5 first makes a request of an SMB server and gets logged in, then later QNX userid 7 tries to make a request and its logon is refused, SMBfsys will use userid 5's connection to satisfy the request. This may give userid 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.
-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.
-u user
When a userid 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 userid 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 on by default.

Examples:

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 &

Description:

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 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 it's 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.

Files:

/etc/services

See also: