[Previous] [Contents] [Next]

SMBfsys

SMB Filesystem Client (QNX)

Syntax:

SMBfsys [-d nminutes] [-i size] [-N] [-n name]
        [-o] [-p priority] [-P [~]semantic] 
        [-r nseconds] [-R bufsize] [-S bufsize] 
        [-u user] [-x s|h|a] &

Options:

-d nminutes
If no requests are made for a particular server after nminutes minutes, SMBfsys detaches itself from that server to save resources. It automatically reattaches itself the first time a new request for the server comes in. Note that many SMB servers automatically detach themselves from a client if they don't receive a request from them within a certain time period as well. SMBfsys automatically reattaches 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 are simply a hash function of the filename thus don't require a cache. The downside of this is that multiple files end up with the same inode number. (See description.)
-N
Turn off TCP_NODELAY socket option (default is on). Performance to NT servers is helped when TCP_NODELAY is set on.
-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 uses name as the NetBIOS name instead.
-o
When a request comes in from a QNX user ID that SMBfsys hasn't 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 normally returns 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 is 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 uses 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 actually make the deletion 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 hasn't 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't find the user ID in /etc/passwd, it uses user as the username to be given to the SMB server. The default is guest.
-x s|h|a
Use the DOS system (s) or hidden (h) attributes to indicate POSIX execute permission on a file, or have all (a) files executable (system and hidden aren't used). The default is to use the system attribute.

Note that the DOS/Windows/NT DIR command doesn't display files with the system or hidden attributes by default. That means that making a file executable on the QNX side causes 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 either have to use DIR /A or use some other command that shows files with those attributes.

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 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 share the same inode value). For the most part, file inode values are unimportant, but certain programs do look at them (e.g. cp uses them to determine if the source and destination are the same file). There's no corresponding value available from an SMB serve,r 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 depends 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 is 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 always remains constant, but two different files might return the same inode value if they hash to the same number.

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 &

Files:

/etc/services
The service-name database.

Caveats:

SMBfsys requires a socket manager.

See also:

Dosfsys, Fsys, mount, mount_smb, umount, user_smb

Socket, Socklet in the TCP/IP User's Guide


[Previous] [Contents] [Next]