cmogstored.git  about / heads / tags
alternative mogstored implementation for MogileFS
blob 8b6eb75280b26e97f2885919b42684e96643e35b 497 bytes (raw)
$ git show HEAD:path_parser.rl	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
 
/*
 * Copyright (C) 2012-2020 all contributors <cmogstored-public@yhbt.net>
 * License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
 */

/*
 * caller needs to setup: uint32_t *mog_devid = ...
 */
%%{
	machine path_parser;

	devid = "dev"
		(digit+) $ {
			/* no overflow checking here, we do it in mog_dev_new */
			*mog_devid *= 10;
			*mog_devid += fc - '0';
		}
		'/';
	# only stuff MogileFS will use
	mog_path_rest = [a-zA-Z0-9/\.\-]{0,36};
	mog_path = '/' (devid)? mog_path_rest;
}%%

git clone https://yhbt.net/cmogstored.git