use crate::nfs::types::*;
+// Maximum number of operations per compound
+// Linux defines NFSD_MAX_OPS_PER_COMPOUND to 16 (tested in Linux 5.15.1).
+const NFSD_MAX_OPS_PER_COMPOUND: u32 = 64;
+
#[derive(Debug,PartialEq)]
pub enum Nfs4RequestContent<'a> {
PutFH(Nfs4Handle<'a>),
tag_len: be_u32
>> _tag: cond!(tag_len > 0, take!(tag_len))
>> _min_ver: be_u32
- >> ops_cnt: be_u32
+ >> ops_cnt: verify!(be_u32, |&v| v <= NFSD_MAX_OPS_PER_COMPOUND)
>> commands: count!(parse_request_compound_command, ops_cnt as usize)
>> (Nfs4RequestCompoundRecord {
commands
status: be_u32
>> tag_len: be_u32
>> _tag: cond!(tag_len > 0, take!(tag_len))
- >> ops_cnt: be_u32
+ >> ops_cnt: verify!(be_u32, |&v| v <= NFSD_MAX_OPS_PER_COMPOUND)
>> commands: count!(nfs4_res_compound_command, ops_cnt as usize)
>> (Nfs4ResponseCompoundRecord {
status: status,