# Max length file name and dir name in UFS source



## Vagner (Aug 27, 2012)

Hi all!
I find define MAXNAMLENGTH =255 at /usr/src/sys/ufs/ufs/dir.h, /usr/include/ufs/ufs/dir.h and define _POSIX_PATH_MAX at /usr/include/limits.h. But this define depends on the size of the block. How i can change this limit?


----------



## expl (Aug 27, 2012)

Vagner said:
			
		

> Hi all!
> I find define MAXNAMLENGTH =255 at /usr/src/sys/ufs/ufs/dir.h, /usr/include/ufs/ufs/dir.h and define _POSIX_PATH_MAX at /usr/include/limits.h. But this define depends on the size of the block. How i can change this limit?



I don't think you can increase the limit beyond 255bytes for filenames, I recon it would need some (very) heavy hacking on UFS drivers (related to metadata allocation), making your filesystem incompatible with the standard of both UFS1/2 and BSD/UNIX in general.


----------



## un_x (Nov 9, 2012)

Vagner said:
			
		

> I find define MAXNAMLENGTH =255 at /usr/src/sys/ufs/ufs/dir.h, /usr/include/ufs/ufs/dir.h and define _POSIX_PATH_MAX at /usr/include/limits.h. But this define depends on the size of the block. How i can change this limit?



Why would anyone want a filename longer than 255 characters? 

I remember discussions about this on the mailing list about 20 years ago ... if you are very interested, you may want to search the mailing list archives circa 1994-6   To the best of my very fuzzy memory, they did expand some aspects of the filesystem - like path lengths from 1024 to 4096 or something - about the same time that they were trying to get usernames with more than 8 characters and some other related expansions.  My memory is very fuzzy, so ... for whatever it is worth ... But that was the timeframe when they were doing these kind of things to move the early FreeBSD 1.x/2.x into a useable production quality system that would work for most people in most server conditions, and they had to deal with some of these kind of problems that various admins were demanding.  Too soon old, and too late smart.


----------



## un_x (Nov 9, 2012)

Additionally, IF you are very interested in the topic, you could probably check the source archives for the early FreeBSD releases, and look for any patches or diffs or whatever for the early 1.x/2.x releases which made changes to the UFS.


----------

